<div class="row m-n">
    <div class="crumbs-bar">
        <div yb-crumbs></div>
    </div>
    <div tabset type="tab">
        <div tab heading="历史版本" active="activeFlag[0]" ng-click="changeTab(0)">
            <div class="row wrapper-y-sm">
                <div class="operate-bar col-xs-4 font-0">
                    <button class="btn btn-operate m-r-sm" ng-click="addData()"
                            ng-disabled="!btnPermission.appSettingAdd" title="{{!btnPermission.appSettingAdd?'无权限执行此操作':''}}">新增</button>
                </div>
                <div class="search-bar wrapper-none col-xs-8">
                    <div class="btn-group m-l-xs pull-right">
                        <button type="button" class="btn btn-default base-color" ng-click="search()" title="刷新">
                            <i class="yb-icon ico-refresh"></i>
                        </button>
                    </div>
                    <button class="btn-advance pull-right m-l-xs" ng-click="switchToolbar('AdvanceSearch')">高级搜索</button>
                    <div class="input-group pull-right clearfix">
                        <input type="text" class="form-control txt-search" placeholder="版本号" ng-model="condition.version">
                        <span class="input-group-addon cursor-pointer" ng-click="search(1)">搜索</span>
                    </div>
                </div>
            </div>
            <div yb-advance-search show-toolbar="toolbarConfig.showAdvanceSearch" search-data="search(1)" reset-data="reset()">
                <div class="advance-search m-t-sm">
                    <div class="form-group clearfix">
                        <label class="control-label">类型：</label>
                        <select class="form-control" ng-model="condition.type">
                            <option value=''>请选择</option>
                            <option value=0>PDA</option>
                            <option value=1>PDA(手机端)</option>
                            <option value=2>App</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="main-area">
                <div yb-table-fixed class="table-fixed-wrap">
                    <div class="th-scroll-x">
                        <table class="table-fixed border-none" width="{{tbConf.scrollWidth}}">
                            <thead>
                            <tr>
                                <th ng-repeat="itemCol in tbConf.tableCol track by $index" width="{{itemCol.width}}"
                                    ng-show="!!itemCol.isShow && !itemCol.isFixed">
                                    <div yb-thead-operate ng-model="itemCol" target-width="tbConf.scrollWidth"></div>
                                </th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="dataList.length > 0">
                        <table class="table-fixed border-none" width="{{tbConf.scrollWidth}}">
                            <tbody>
                            <tr ng-repeat="item in dataList track by $index" ng-class="{'row-selected': $index === markInfo.curRow}"
                                ng-click="selectRow($index)">
                                <td class="spill-dots" ng-repeat="itemCol in tbConf.tableCol track by $index"
                                    width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !itemCol.isFixed"
                                    title="{{item[itemCol.dataField]}}">
                                    <span ng-if="!itemCol.clickFn && itemCol.type !== 'operate'">{{item[itemCol.dataField]}}</span>
                                    <a class="btn-operate m-r-xs" ng-click="tdClick(item, itemCol.clickFn)" ng-if="!!itemCol.clickFn">
                                        {{item[itemCol.dataField]}}
                                    </a>
                                    <div class="font-0" ng-if="itemCol.type === 'operate'">
                                        <button class="btn btn-operate m-r-xs" ng-click="editData(item)"
                                                ng-disabled="!btnPermission.appSettingEdit" title="{{!btnPermission.appSettingEdit?'无权限执行此操作':''}}">编辑</button>
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="dataList.length === 0">暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area page-bar wrapper-y-sm clearfix">
                <div yb-page-info ng-model="pageInfo" yb-refresh="search()"></div>
            </div>
        </div>
        <div tab heading="新增" active="activeFlag[1]" ng-if="activeFlag[1]">
            <div class="main-area d-t-35 d-b-15">
                <form name="dataForm" class="main-wrap form-horizontal single-col p-t clearfix" novalidate>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">类型：</label>
                        <div class="col-xs-5 wrapper-none">
                            <select class="form-control" ng-model="detailInfo.type" required>
                                <option value=1>PDA</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group m-b-xs">
                        <label class="col-xs-2 control-label"><i>*</i>版本包：</label>
                        <label class="col-xs-5 control-label p-l-n text-left clearfix">
                            <span class="btn btn-operate col-xs-1 text-left" ngf-select ng-model="fileObj" ngf-change="checkFileType(fileObj)" required name="apkFile">添加文件</span>
                            <span class="m-l-sm col-xs-8 spill-dots" title="{{fileObj.name}}">{{fileObj.name}}</span>
                        </label>

                        <div class="col-xs-4 msg-block" ng-show="(dataForm.apkFile.$error.required && submitted) || fileFormatErr || fileUploadErr">
                            <div class="error-msg" ng-if="dataForm.apkFile.$error.required && submitted">
                                <i class="yb-icon ico-times-circular"></i>必填项，请填写
                            </div>

                            <div class="error-msg" ng-if="fileFormatErr && !dataForm.apkFile.$error.required">
                                <i class="yb-icon ico-times-circular"></i>请选择 apk 格式的文件
                            </div>

                            <div class="error-msg" ng-if="fileUploadErr && !dataForm.apkFile.$error.required">
                                <i class="yb-icon ico-times-circular"></i>文件上传失败
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><i>*</i>版本号：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="version" class="form-control" ng-model="detailInfo.version" maxlength="20" ng-readonly="detailInfo.type!=2" required yb-focus>
                            <span ng-if="detailInfo.type!=2">例：包名：xxxx_2.8.0.apk，则版本号为2.8.0</span>
                        </div>
                        <div class="col-xs-4 msg-block"
                             ng-show="dataForm.version.$dirty || (dataForm.version.$invalid && submitted)">
                            <div class="error-msg" ng-if="dataForm.version.$error.required && !dataForm.version.focused">
                                <i class="yb-icon ico-times-circular"></i>必填项，请填写
                            </div>
                        </div>
                    </div>
                    <div class="form-group m-b-xs">
                        <label class="col-xs-2 control-label"><i>*</i>名称：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="name" class="form-control" ng-model="detailInfo.name" maxlength="20" required yb-focus>
                        </div>
                        <div class="col-xs-4 msg-block"
                             ng-show="dataForm.name.$dirty || (dataForm.name.$invalid && submitted)">
                            <div class="error-msg" ng-if="dataForm.name.$error.required && !dataForm.name.focused">
                                <i class="yb-icon ico-times-circular"></i>必填项，请填写
                            </div>
                        </div>
                    </div>
                    <div class="form-group m-b-sm">
                        <label class="col-xs-2 control-label">是否强制升级：</label>
                        <label class="col-xs-5 control-label p-l-n text-left clearfix">
                            <input type="radio" class="m-r-sm pull-left" ng-model="detailInfo.isRigidUpdate" yb-radio
                                   value="true" yb-radio-name="是">
                            <input type="radio" class="m-r-sm pull-left" ng-model="detailInfo.isRigidUpdate" yb-radio
                                   value="false" yb-radio-name="否">
                        </label>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">版本说明：</label>
                        <div class="col-xs-5 wrapper-none">
                            <textarea type="text" name="remark" class="form-control" ng-model="detailInfo.note" maxlength="200"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"></label>
                        <div class="col-xs-5 wrapper-none">
                            <button type="button" class="btn btn-primary m-r-sm" ng-click="saveData(dataForm.$valid, fileObj)">
                                保存
                            </button>
                            <button type="button" class="btn btn-default" ng-click="cancel()">取消</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div tab heading="编辑" active="activeFlag[2]" ng-if="activeFlag[2]">
            <div class="main-area d-t-35">
                <form name="dataForm" class="main-wrap form-horizontal single-col p-t clearfix" novalidate>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">类型：</label>
                        <label class="col-xs-5 control-label p-l-n text-left clearfix">
                            {{appTypeMap[orderObj.type]}}
                        </label>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">文件名：</label>
                        <label class="col-xs-5 control-label p-l-n text-left clearfix">
                            {{orderObj.fileName}}
                        </label>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><i>*</i>版本号：</label>
                        <label class="col-xs-5 control-label p-l-n text-left clearfix">
                            {{orderObj.version}}
                        </label>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><i>*</i>名称：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="name" class="form-control" ng-model="orderObj.name" maxlength="20" required yb-focus>
                        </div>
                        <div class="col-xs-4 msg-block"
                             ng-show="dataForm.name.$dirty || (dataForm.name.$invalid && submitted)">
                            <div class="error-msg" ng-if="dataForm.name.$error.required && !dataForm.name.focused">
                                <i class="yb-icon ico-times-circular"></i>必填项，请填写
                            </div>
                        </div>
                    </div>
                    <div class="form-group m-b-sm">
                        <label class="col-xs-2 control-label">是否强制升级：</label>
                        <label class="col-xs-5 control-label p-l-n text-left clearfix">
                            <input type="radio" class="m-r-sm pull-left" ng-model="orderObj.isRigidUpdate" yb-radio
                                   value="true" yb-radio-name="是">
                            <input type="radio" class="m-r-sm pull-left" ng-model="orderObj.isRigidUpdate" yb-radio
                                   value="false" yb-radio-name="否">
                        </label>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">版本说明：</label>
                        <div class="col-xs-5 wrapper-none">
                            <textarea type="text" name="remark" class="form-control" ng-model="orderObj.note" maxlength="200"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"></label>
                        <div class="col-xs-5 wrapper-none">
                            <button type="button" class="btn btn-primary m-r-sm" ng-click="updateData(dataForm.$valid)">
                                保存
                            </button>
                            <button type="button" class="btn btn-default" ng-click="cancel()">取消</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>